package com.sx.manage.controller.bank;

import java.io.IOException;
import java.io.UnsupportedEncodingException;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sx.manage.controller.base.MBaseController;
import com.sx.manage.service.bank.IMBaseConsumerBankMapService;
import com.sx.model.manage.mybatis.form.bank.MConsumerBankMapForm;
import com.sx.model.manage.mybatis.vo.bank.MDropDownVO;
import com.sx.model.manage.mybatis.vo.result.ResultDropDownListVO;

/**
 * 用户银行关系
 * 
 * @author admin
 *
 */
@Controller
@RequestMapping("/user_bank")
public class MUserBankMapController extends MBaseController {

	private Logger log = LoggerFactory.getLogger(this.getClass());

	@Resource(name = "mBaseConsumerBankMapServiceImpl")
	private IMBaseConsumerBankMapService mBaseConsumerBankMapServiceImpl;

	/**
	 * 
	 * @param request
	 * @return
	 * @throws ServletException
	 * @throws IOException
	 */
	@RequestMapping("/query_user_bank_account")
	@ResponseBody
	public ResultDropDownListVO<MDropDownVO> ajax_bank_account_adjust(HttpServletRequest request) {
		String str = request.getQueryString();
		String q = str.split("&")[0];
		MConsumerBankMapForm bankMapForm = new MConsumerBankMapForm();
		log.info("查询用户银行子账号q={}",q);
		if (null != q) {
			try {
				String bank_account_no = new String(q.split("=")[1].getBytes("iso8859_1"));
				bankMapForm.setBank_account_no(java.net.URLDecoder.decode(bank_account_no, "utf-8"));
			} catch (UnsupportedEncodingException e) {
				log.info("字符串编码修改", e);
			}
		}
		return mBaseConsumerBankMapServiceImpl.query_consumerBank(bankMapForm);
	}

}
